package sample.api.client;

import org.dreamwork.secure.AlgorithmMapping;
import org.dreamwork.secure.SecureContext;

import java.security.PublicKey;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2014/12/22
 * Time: 20:28
 */
public class RestfulApiContext {
    public static SecureContext secureContext = new SecureContext ();

    private static PublicKey publicKey;

//    public static final String baseURL = "${base-url}";
    public static final String baseURL = "http://192.168.0.22:8080/work-order/api/v1.0/";
    public static final String appId = "salon";
//    public static final String appId = "${app-id}";

    static {
/*
        secureContext.setBlockEncryption (AlgorithmMapping.find ("${block-encryption"));
        secureContext.setSignature (AlgorithmMapping.find ("${signature}"));
        secureContext.setKeyTransport (AlgorithmMapping.find ("${key-transport}"));
*/
        secureContext.setBlockEncryption (AlgorithmMapping.find ("http://www.w3.org/2001/04/xmlenc#aes128-cbc"));
        secureContext.setSignature (AlgorithmMapping.find ("http://www.w3.org/2000/09/xmldsig#rsa-sha1"));
        secureContext.setKeyTransport (AlgorithmMapping.find ("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"));
    }

    public static void setPublicKey (PublicKey kek) {
        publicKey = kek;
    }

    public static PublicKey getPublicKey () {
        return publicKey;
    }
}